home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 January / MacHome Magazine Demo Disc January 2001.iso / pc / Software / Applications / Squeak app design envir. ….sea / Squeak app design envir. 2.8 / README.MacOT < prev    next >
Encoding:
Text File  |  2000-06-18  |  9.8 KB  |  195 lines  |  [TEXT/R*ch]

  1. Notes from John M McIntosh <johnmci@smalltalkconsulting.com>
  2. Subject: New Mac VM 68K and Open Transport (Q/A) PPC too.
  3.  
  4.  
  5.  
  6. PPC Notes: 
  7.  
  8. For the PPC you need Open Transport 1.1.2, why? Well earlier versions are
  9. broken. If you have an earlier version you can find a 1.1.2 updater on Apple
  10. support site. The new VM was tested on PPC version of the Mac OS from
  11. version 7.5.3 thru to OS 9.04 (7.5.3 7.5.3 update 2, 7.5.5 7.6, 7.6.1 8.0
  12. 8.1 8.5 8.6 9.0x) (Sigh did I miss one)? Also with various flavors of OT.
  13. Having a test suite made this task tedious but viable.
  14.  
  15. 68K Notes:
  16.  
  17. One of the goals when writing the new open transport based tcp/ip code for
  18. the macintosh was that it really needed to run on 68K machines. This support
  19. is NOT shipped with the standard VM, when running on a 68K machine you run
  20. the old MacTCP version. Perhaps later we'll offer the OT version as a
  21. plugin, here's why:
  22.  
  23. The Fat VM is built using Apple's code fragment manager (CFM). This means
  24. for one thing you must have the 68K version of the CFM manager on your 68K
  25. machine, since bugs exist in some implementations ensure you have the latest
  26. from Apple's support site. Of course in order to run Squeak you need this...
  27.  
  28. The issue! Apple in their wisdom introduced a CFM version of OT for version
  29. 1.3. The problem is that OT 1.3 is NOT a standalone upgrade, it comes with
  30. System 8.1. Therefore the OT version of the 68K code only would work on a
  31. limited number of 68040 machines and you need a System 8.0 cd and the 8.1
  32. updater. Now if you do have a version of OT 1.3 around you can copy the
  33. libraries and use them on earlier OS back to 7.x. One of my test machines is
  34. a lowly 68030 Mac SE/30 which used 7.5.5 and OT 1.3 to prove this point.
  35.  
  36. There may or may not be an improvement gain, the macTCP software has a
  37. shorter code path than the OT code, but the new code runs faster if you
  38. increase the buffers you hand the primitives and the listen/accept logic
  39. doesn't drop any incoming connections so it's more robust, it took a few
  40. hours to run the test suite but it did run. Oh and there's the UDP support.
  41.  
  42. For people that really want a 68K version with OT you can email me and I'll
  43. see about shipping you one, at some point here I guess we'll post a real
  44. version once I've seen any bug reports. For developers who have Code Warrior
  45. around and time on your hands you can build your own.
  46.  
  47. Lastly I don't have permission to give anyone the OT1.3 libraries, sorry
  48. don't ask...
  49.  
  50.  
  51. Subject: Socket Test Suite (is coming)
  52.  
  53.  
  54. As soon as I get the test suite to work on Linux I'll ship it.
  55.  
  56. When I was building the macintosh Open Transport code an interesting
  57. objective was given. You must mimic the behavior of the old MacTCP code.
  58. Well how and how do you test that? Of course the code is only documentation
  59. it's not if there is a specification around. Oh and make it work on 68K and
  60. PPC and all versions of the Mac OS back till the pre-Jobs era when we had
  61. the OS flavor of the month, that just screams for automation eh?
  62.  
  63. So to solve this problem and preserve my sanity I bit the bullet and spent
  64. many many hours building SUnit test case(s). Once I ship them you'll see
  65. they are rough but the important thing was that I can run them on an old VM
  66. using macTCP and the new VM using OT and they agree! They also allowed me to
  67. tinker somewhat with the Smalltalk Socket class and ensured that the
  68. behavior was the same as the historical pattern, well almost nope 257.0.0.0
  69. is NOT a valid IP address, previous version of the resolver code disagreed
  70. on this point.
  71.  
  72. To the people that promote this as the way to go, yes I coded test cases
  73. then wrote the C code. I agree this is great, many times I found I wrote
  74. 'perfect' C code then tripped over a failure cheerfully pointed out by the
  75. test suite. Also a few problems with OT versions popped up when I ran the
  76. suite across a zillion macintosh OSs. In retrospect attempting to prove that
  77. the code would work across all these different macintosh environments would
  78. have proved impossible without a test suite.
  79.  
  80. I am hoping here that this will lay the foundation for a test suite we can
  81. all use to validate the behavior of the socket primitives across all the
  82. platform implementations. Right now there are differences between how the
  83. mac version behaves and the linux version works, these little gothas can
  84. cause problems for application programmers. Of course this should also
  85. expand to cover other important plugins that are platform dependent.
  86.  
  87. Oh one last little thing I managed to violate an XP tenet and shipped Dan a
  88. version of code to fix a very interesting problem he discovered at the last
  89. minute and he promptly shipped that code to you all. Then I ran the full
  90. test suite and discovered to my horror my one line change caused dreadful
  91. side effects if you do socket close;close;close  (Not that you do that in
  92. production code). This of course prompted a fix which is in the update
  93. stream, the VM on the server was fixed early early this morning, and I don't
  94. think anyone got their hands on the broken one.
  95.  
  96.  
  97. Subject: Mac VM and Open Transport and performance numbers.
  98.  
  99.  
  100. For the curious one of the things I attempted to do was to support a high
  101. performance Squeak based tcp/ip server when I was writing the new software.
  102. This drove some design decisions in the new C code. Once the code was
  103. written, well how to test, since in reality I didn't really have a high
  104. performance tcp/ip server to use, the intent is there, just no code.
  105.  
  106. To solve this issue I wrote a little application that builds a listen socket
  107. and spins off a socket to handle the incoming request, which picks a
  108. solution from a collection of random choices (think static HTML) and sends
  109. that to the client and then closes the socket, much like many HTTP servers
  110. do today. Multiple Smalltalk processes and shared queues are used to do
  111. this. (I'll ship this application in a day or so).
  112.  
  113. I was interested in how many connections per second, how big was the backlog
  114. queue, how much data was shipped, how long did servicing each request take,
  115. and did we drop anything.
  116.  
  117. I ran this application on a PowerBook 500Mhz and used various clients on a
  118. 10Mbit ethernet segment to continuously make requests to it.
  119.  
  120. Ok the numbers: 
  121.  
  122. I was limited to the number of clients but I served up 48 connections per
  123. second sustained that's about 4.1 millions connects per day. Peak was 112
  124. connections per second, with 21 requests outstanding at anyone point on
  125. average. One of my tests moved 12.59 GB of data, or about 3.815 Mbits a
  126. second with an average of 9,887 bytes per response (A few bytes to 20,000
  127. were the choices). I had some other test results where I used some more
  128. clients and got 58 connections per second (that's 5 million per day) with a
  129. average bit rate of 4,706,028. One case using a 100MBit Lan did over 12MBit
  130. peak. You should be aware that I could browse around in the server image
  131. while this was going on and I didn't have any response time issues.
  132.  
  133. Service request times.
  134. I took a random sample of 25945 connections across 7 hours and found:
  135. 75% completed in 100ms That is the time from the point of accept at the
  136. listen to when we have sent the data and closed the socket.
  137.  
  138. 84.36% completed in 500ms or less
  139. 89.63% completed in 1000ms or less
  140. 95.51% completed in 2000ms or less
  141. 98.05% completed in 5000ms or less
  142. 99.16% completed in 8000ms or less
  143. 99.65% completed in 10 seconds or less
  144. with 1 at 17 and 1 at 24 seconds.
  145.  
  146. Please note the client software actually forked off 7 connections per
  147. iteration thru a loop and I think some of the clients were CPU starved and
  148. some buffer flow logic in the code tends to skew to higher numbers, but the
  149. waitForDataUntil was set to 10 seconds, so nearly all the clients were
  150. serviced within one iteration of their read loop.
  151.  
  152. In a 7 hour run I did not drop any data according to the client logs, and I
  153. had one read failure, one of my Linux VMs locked up! Since I don't have
  154. anything to compare this to I can't say how good it is. Mind it would appear
  155. a midrange Squeak server could saturated a T1 line.
  156.  
  157. Oh and the interesting thing was this testing pointed out a number of issues
  158. with the external semaphore signaling table which of course is fixed in the
  159. latest updates.
  160.  
  161. Subject: Re: Squeak, NT, CGI and Microsofts web server?
  162. on 6/17/00 4:18 AM, Stefan Matthias Aust at sma@3plus4.de wrote:
  163.  
  164. > Probably not with a default Squeak.  I haven't tested but I think I read
  165. > something like that socket requests are serialized because the VM can't
  166. > deal with multiple simultaneous request.  Or perhaps that's only true for a
  167. > Mac?
  168.  
  169. On the mac this is no longer true, the new OT socket code does most things
  170. at the interrupt level. In testing I had as much as 150 incoming socket
  171. accepts pending. Technically each of these had been accepted at the tcp/ip
  172. level and were waiting for Squeak to confirm the accept or disconnect (of
  173. course we wanted to accept them).
  174.  
  175. The same applies for reading, incoming data is of course queued at the
  176. socket level, but at some 'magical' point based on socket buffer usage and
  177. thresholds etc etc it notifies the application that data has arrived via an
  178. interrupt, you can of course fiddle with these thresholds using  socket
  179. options if you dare. As mentioned at some point we get an interrupt from the
  180. OS and we read the data into some statically allocated buffers and signal
  181. the read semaphore if required. Later when Squeak gets around to reading the
  182. data, we of course just copy data out of the buffer into the supplied
  183. Smalltalk string and put the buffer back on a free queue.
  184.  
  185.  
  186. Note one of the interesting things here is what if the statically allocated
  187. buffers are exhausted. At this point by not handling the read interrupt it
  188. causes the invocation of tcp/ip flow control, and we also signal we have
  189. data. Later when Squeak wakes up we read data from the socket directly into
  190. the Squeak string. At some point we hope the buffers will be freed and go
  191. back to normal processing. This logic prevents all work from stopping.
  192.  
  193.  
  194.